<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>自定义事件</title>
  <script src="./js/jquery.js"></script>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    .dv {
      width: 300px;
      height: 300px;
      background-color: purple;
    }
  </style>
</head>
<!-- 
  自定义事件必须满足两个条件:
    1.on 来绑定事件
    2.trigger 来触发的
      或则triggerHandler来触发的事件
 -->

<body>
  <div class="dv myclick">

  </div>
</body>
<script>
  "use strict";
  $(function () {
    $(".dv.myclick").on("my", function () {
      console.log(`自定义事件触发了吧...`);
    });
    // $(".dv.myclick").trigger("my");
    $(".dv.myclick").triggerHandler("my");
  });
</script>

</html>